{extend name="public/base" /}

{block name="main"}

<el-row> <!--type="flex"  justify="end"-->
    <el-form :inline="true" :model="formInline"  size="small">
        <el-form-item label="KEY">
            <el-input v-model="formInline.key" ></el-input>

            <!--<el-autocomplete
                    class="inline-input"
                    v-model="state1"
                    :fetch-suggestions="querySearch"
                    placeholder="KEY"
                    @select="handleSelect"
            ></el-autocomplete>-->


        </el-form-item>
        {foreach $dimension as $key=>$vo }
        <el-form-item label="{$vo}">
            <el-input  v-model="formInline.{$key}"></el-input>
        </el-form-item>
        {/foreach}

        <el-form-item>
            <el-button type="primary" @click="onSubmit">查询</el-button>
        </el-form-item>
        <el-form-item>
            <el-link type="primary" href="/createconfig" target="_blank">新建</el-link>
            <!-- <el-button type="primary" >新建</el-button>-->
        </el-form-item>
    </el-form>


</el-row>
<el-row>
    {include file="public/table_config" tp=""  /}
</el-row>
<el-row type="flex" justify="end">
    <el-pagination small

                   @current-change="handleCurrentChange"
                   :current-page.sync="formInline.page"
                   :page-size="100"
                   layout="total, prev, pager, next"
                   :total="total">
    </el-pagination>
</el-row>

<el-row class="rem">

    <el-divider></el-divider>
    <div >字段说明:</div>
    <div >日访问：本行数据今日访问次数</div>
</el-row>



{/block}

{block name="js"}

<script>
    var selectdata={:json_encode($selectdata)};
</script>

<script>


    var _vue_ = new Vue({
        el: '#app',
        data: {
            tableData: [],
            total: 0,
            formInline: selectdata,
        },

        methods: {

            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);

                var vm = this;
                axios
                    .get('/index/api/selectconfig', {params: vm.formInline})
                    .then(function (response) {
                        console.log(response.data);
                        vm.tableData = response.data.list;
                        if (response.data.total) vm.total = response.data.total;
                    });
            },
            onSubmit() {
                console.log('submit!');
                this.handleCurrentChange(1);
            },

        },

        mounted: function () {
            this.handleCurrentChange(1);
        }

    });

</script>

{/block}